const modulesFiles = require.context('./', true, /\.vue$/)

// you do not need `import app from './modules/app'`
// it will auto require all vuex module from modules file
const components = modulesFiles.keys().reduce((modules, modulePath, i) => {
  const value = modulesFiles(modulePath)
  modules[i] = value.default
  return modules
}, [])
console.log(components)
const install = function(Vue) {
  components.forEach((component) => {
    console.log(component)
    Vue.component(component.name, component)
  })
}

export default install
